<template>
  <div>
    <h1>vue-xlsx-table</h1>
    <vue-xlsx-table @on-select-file="handleSelectedFile">上传xlsx文件转json</vue-xlsx-table>

    <!--导出用户信息excel表格-->
    <download-excel
      class="export-excel-wrapper"
      :data="json_data"
      :fields="json_fields"
      name="用户信息列表.xls"
    >
      <el-button type="primary" size="small">导出EXCEL</el-button>
    </download-excel>
    <el-button type="primary" size="small" @click="sub">通过</el-button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      info: {
        StuId: "202003090303",
        StuName: "xyk",
        StuAge: 18,
        StuSex: "女",
        StuCarid: "123456789102369874",
        ClassId: "2020030903",
        StubackTime: "2022-03-04T00:00:00",
        StuPhone: "12345678910",
        PoliticalLandscape: "群众",
        NativePlace: "湖南长沙",
        National: "汉",
        StuEmail: "1600658861@qq.com"
      },
      //导出excel
      json_fields: {
        StuName: "StuName",
        StuAge: "StuAge",
        StuSex: "StuSex",
        StuPhone: "StuPhone",
        StuEmail: "StuEmail",
        StuCarid: "StuCarid",
        ClassId: "ClassId",
        StubackTime: "StubackTime",
        PoliticalLandscape: "PoliticalLandscape",
        NativePlace: "NativePlace",
        National: "National"
      },
      json_data: [{}],
      json_meta: [
        [
          {
            " key ": " charset ",
            " value ": " utf- 8 "
          }
        ]
      ],
      theApplicationForm: [
        {
          StuName: "张妍",
          StuAge: "18",
          StuSex: "女",
          StuPhone: "18684702893",
          StuEmail: "zy@qq.com",
          StuCarid: "123456789876543000",
          ClassId: "2020030903",
          StubackTime: "4/5/22",
          PoliticalLandscape: "团员",
          NativePlace: "湖南宁乡",
          National: "汉"
        },
        {
          StuName: "王倩",
          StuAge: "19",
          StuSex: "女",
          StuPhone: "18684702894",
          StuEmail: "wq@qq.com",
          StuCarid: "123456789876543000",
          ClassId: "2020030903",
          StubackTime: "4/6/22",
          PoliticalLandscape: "团员",
          NativePlace: "湖南宁乡",
          National: "汉"
        }
      ]
    };
  },
  created() {},
  mounted() {},
  methods: {
    handleSelectedFile(convertedData) {
      console.log(convertedData);
    },
    sub() {
      this.axios({
        method: "put",
        url: this.$api.AlterStuDeptApproval,
        headers: {
          "Content-Type": "application/json"
        },
        params: {
          token: "94bfc65e-acb5-45f3-9e49-b20bae9e2336",
          status: 1,
          theApplicationForm: {
            Id: 20,
            ApplicantsId: "9001",
            InfoJSON: JSON.stringify(this.theApplicationForm),
            ByTheTime: "2022-04-05T08:15:06.2422059+00:00",
            ApplicationType: 1,
            Status: 2
          }
        }
      }).then(res => {
        console.log(res);
      });
    }
  }
};
</script>

<style scoped >
</style>
